﻿@{
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}
@{
    ViewBag.Title = "nomalIndex";
}

<script   type="text/javascript">
    var lookid;
    function look(obj) {
        lookid = obj.id;
       var aa = window.location.href +"Resource/checkVr?rescourceid="+lookid;
        $.ajax({
            url: "@Url.Action("QRcode")",
                data: { "resourceid": lookid, "url": aa },
                dataType: "json",
                type: "POST",
                success: function (data) {
                    //    $("#dianzan").attr('disabled', true);
                    window.open("@Url.Action("QRcodeImage")"+"?resourceid="+lookid);

                    @*   window.location.href ="@Url.Action("QRcodeImage")"+"?resourceid="+'@Model.resourceid';*@
                }
            });




        // this.style.color = "red";
        //   $("#categorylist").remove(obj.id);
    }
    //变量名中多了空格，倒置调试了半天
    

</script>
<div class="row">



    <section class="col-xs-12 col-sm-9 col-lg-10">
                   <article class="row">
            <div class="col-xs-12"><h4>最新发布</h4></div>
            @foreach (var item in ViewData["newpublic"] as IEnumerable<HMoPro.Models.RescourcerList>)
            {
                <div class="col-xs-6 col-sm-4">
                    <div class="showTm">
                        <a href="@Url.Action("checkVr", new {rescourceid=item.rescourceid})"><img src="../../Uploads/@item.rescourceid/@item.ImageshotFileName" class="img-responsive" /></a>
                        <h5>@Html.DisplayFor(modelItem => item.Title)</h5>
                        <div class="dd">
                            <p class="pull-left">
                                <span class="width-bf db">@Html.DisplayFor(modelItem => item.PlayTime)</span>
                                <span class="width-bf dz">@Html.DisplayFor(modelItem => item.PraiseTime)</span>
                            </p>
                            @{Html.RenderAction("browseListIndex", new { resourceid = item.rescourceid });}
                        </div>
                    </div>
                </div>
            }
        </article>



        <article class="row">
            <div class="col-xs-12"><h4>人气</h4></div>
            @foreach (var item in ViewData["popularity"] as IEnumerable<HMoPro.Models.RescourcerList>)
            {
                <div class="col-xs-6 col-sm-4">
                    <div class="showTm">
                        <a href="@Url.Action("checkVr", new {rescourceid=item.rescourceid})"><img src="../../Uploads/@item.rescourceid/@item.ImageshotFileName" class="img-responsive" /></a>
                        <h5>@Html.DisplayFor(modelItem => item.Title)</h5>
                        <div class="dd">
                            <p class="pull-left">
                                <span class="width-bf db">@Html.DisplayFor(modelItem => item.PlayTime)</span>
                                <span class="width-bf dz">@Html.DisplayFor(modelItem => item.PraiseTime)</span>
                            </p>
                            @{Html.RenderAction("browseListIndex", new { resourceid = item.rescourceid });}
                        </div>
                    </div>
                </div>
            }
        </article>
        <article class="row">
            <div class="col-xs-12"><h4>最赞</h4></div>
            @foreach (var item in ViewData["zan"] as IEnumerable<HMoPro.Models.RescourcerList>)
            {
                <div class="col-xs-6 col-sm-4">
                    <div class="showTm">
                        <a href="@Url.Action("checkVr", new {rescourceid=item.rescourceid})"><img src="../../Uploads/@item.rescourceid/@item.ImageshotFileName" class="img-responsive" /></a>
                        <h5>@Html.DisplayFor(modelItem => item.Title)</h5>
                        <div class="dd">
                            <p class="pull-left">
                                <span class="width-bf db">@Html.DisplayFor(modelItem => item.PlayTime)</span>
                                <span class="width-bf dz">@Html.DisplayFor(modelItem => item.PraiseTime)</span>
                            </p>
                            @{Html.RenderAction("browseListIndex", new { resourceid = item.rescourceid });}
                            @*                            <span class="pull-right"><a href='#' onclick="look(this); return false;" id="@item.rescourceid" class="width-show vr"></a></span>
            <span class="pull-right"><a href='#' onclick="look(this); return false;" id="@item.rescourceid" class="width-show box"></a></span>
            <span class="pull-right"><a href='#' onclick="look(this); return false;" id="@item.rescourceid" class="width-show html5"></a></span>*@
                        </div>
                    </div>
                </div>
            }
        </article>






    </section>




    <aside class="col-xs-12 col-sm-3 col-lg-2" style="min-height: 200px; ">
        <h4>分类目录</h4>
        @if (User.Identity.IsAuthenticated)
        {
            using (Html.BeginForm("Index", "Resource", FormMethod.Post, new { @role = "search", @class = "navbar-form navbar-left" }))
            {
                <div class="form-group">
                    <input class="form-control" id="keyword" name="keyword" type="text" value="" />

                    @*@Html.Editor("keyword", new { @class="form-control"})*@
                </div>
                <input type="submit" id="submit" value="" />
            }
        }
        else
        {
            using (Html.BeginForm("searchResoult", "Resource", FormMethod.Post, new { @role = "search", @class = "navbar-form navbar-left" }))
            {
                <div class="form-group">
                    <input class="form-control" id="keyword" name="keyword" type="text" value="" />
                    @*@Html.Editor("keyword", new { @class = "form-control" })*@
                </div>
                <input type="submit" id="submit" value=" " />
            }


        }
        <div class="BiaoQian">
            @{Html.RenderAction("GetCategory");}
        </div>
</aside>
</div>




@*<script>
    function DrawImage(ImgD, iwidth, iheight) {
        //参数(图片,允许的宽度,允许的高度)    
        var image = new Image();
        image.src = ImgD.src;
        if (image.width > 0 && image.height > 0) {
            if (image.width / image.height >= iwidth / iheight) {
                if (image.width > iwidth) {
                    ImgD.width = iwidth;
                    ImgD.height = (image.height * iwidth) / image.width;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
            } else {
                if (image.height > iheight) {
                    ImgD.height = iheight;
                    ImgD.width = (image.width * iheight) / image.height;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
            }
        }
    }
</script>
<h2>nomalIndex</h2>

<table>
@foreach (var item in Model) {
    <tr>
  
        <td>
          <a href="@Url.Action("checkVr", new {rescourceid=item.rescourceid})"> <img src="../../Uploads/@item.rescourceid/@item.ImageshotFileName" onload="javascript:DrawImage(this,300,200)" /></a>
        </td>

        <td>
            播放数：
            @Html.DisplayFor(modelItem => item.PlayTime)
        </td>
        <td>
            点赞数：
            @Html.DisplayFor(modelItem => item.PraiseTime)
        </td>
    </tr>
}

</table>*@
